/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package snail.data;

import java.util.List;
import org.hibernate.Query;
import snail.model.Category;

/**
 *
 * @author hellmer
 */
public class CategoryDAO extends GenericHibernateDAO<Category, Integer> implements ICategoryDAO {

    @Override
    public List<Category> getAll() {
        Query q = getSession().getNamedQuery(QUERY_ORDERBYNAME);
        return q.list();
    }


    public void deleteCategory(int id){
        Query query = getSession().getNamedQuery(ICategoryDAO.QUERY_DELETE);
        query.setParameter("id", id);

        query.executeUpdate();
    }
}
